package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateAppTypeDTO;
import com.itlong.cloud.POJO.DTO.operate.OperateAppTypeGetPageDTO;
import com.itlong.cloud.POJO.VO.operate.InterfaceVO;
import com.itlong.cloud.POJO.VO.operate.OperateAppTypeVO;
import com.itlong.cloud.operate.service.IOperateAppTypeService;
import com.itlong.cloud.project.operate.IOperateAppTypeServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <desc>
 *    应用类型暴露接口实现类
 * </desc>
 *
 * @createDate 2021-08-04
 */
@RestController
public class OperateAppTypeServiceResource implements IOperateAppTypeServiceClient {

    @Autowired
    IOperateAppTypeService iOperateAppTypeService;


    /**
    * <desc>
    *      查询、获取应用类型列表
    * </desc>
    * @param appTypeGetPageDto
    * @return: com.itlong.cloud.utils.page.Page<com.itlong.cloud.POJO.VO.operate.OperateAppTypeVO>
    * @author LiuYu
    * @date: 2021-08-16
     **/
    @Override
    @RequestMapping("/operate/appType/getAppTypeList")
    public Page<OperateAppTypeVO> getAppTypeList(@RequestBody OperateAppTypeGetPageDTO appTypeGetPageDto) {
        return iOperateAppTypeService.getAppTypeList(appTypeGetPageDto);
    }
    /**
    * <desc>
    *      添加应用类型
    * </desc>
    * @param operateAppTypeDTO
    * @return: java.lang.Integer
    * @author LiuYu
    * @date: 2021-08-16
     **/
    @Override
    @RequestMapping("/operate/appType/save")
    public Integer save(@RequestBody OperateAppTypeDTO operateAppTypeDTO) throws Exception {
        return iOperateAppTypeService.save(operateAppTypeDTO);
    }

    /**
    * <desc>
    *      修改应用类型
    * </desc>
    * @param operateAppTypeDTO
    * @return: java.lang.Integer
    * @author LiuYu
    * @date: 2021-08-16
     **/
    @Override
    @RequestMapping("/operate/appType/update")
    public Integer update(@RequestBody OperateAppTypeDTO operateAppTypeDTO) throws Exception {
        return iOperateAppTypeService.update(operateAppTypeDTO);
    }

    /**
    * <desc>
    *      删除应用类型
    * </desc>
    * @param ids
    * @return: java.lang.Integer
    * @author LiuYu
    * @date: 2021-08-16
     **/
    @Override
    @RequestMapping("/operate/appType/delete")
    public Integer delete(@RequestParam("ids") String ids) {
        return iOperateAppTypeService.delete(ids);
    }

    /**
    * <desc>
    *      获取分配接口类型
    * </desc>
    * @param appTypeId
    * @return: java.util.List<com.itlong.cloud.POJO.VO.operate.InterfaceVO>
    * @author LiuYu
    * @date: 2021-08-16
     **/
    @Override
    @RequestMapping("/operate/appType/getAllotInterfaces")
    public List<InterfaceVO> getAllotInterfaces(@RequestParam("appTypeId")String appTypeId) {
        return iOperateAppTypeService.getAllotInterfaces(appTypeId);
    }

    /**
    * <desc>
    *      分配接口类型提交
    * </desc>
    * @param appTypeId
    * @param ids
    * @return: java.lang.Integer
    * @author LiuYu
    * @date: 2021-08-16
     **/
    @Override
    @RequestMapping("/operate/appType/commitAllotInterfaces")
    public Integer commitAllotInterfaces(@RequestParam("appTypeId") String appTypeId,@RequestParam("ids") String ids) {
        return iOperateAppTypeService.commitAllotInterfaces(appTypeId,ids);
    }
}
